package com.ht.web_vr_home_tour_backend.config;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.ht.web_vr_home_tour_backend.obj.enums.ObjType;

import java.io.IOException;

public class ObjTypeSerialize extends JsonSerializer<ObjType> {
    @Override
    public void serialize(ObjType value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        gen.writeStartObject();
        gen.writeStringField("id", value.name());
        gen.writeStringField("contentType", value.getContentType());
        gen.writeStringField("contentName", value.getContentName());
        gen.writeStringField("color", value.getColor());
        gen.writeEndObject();
    }
}
